<template>
	<view class="my-userinfo">
		<!-- 头像和名称 -->
		<view class="top-box">
			<image :src="userinfo.avatarUrl"></image>
			<view class="name">{{userinfo.nickName}}</view>
		</view>
		
		<!-- 面板区域 -->
		<view class="pancel-list">
			<!-- 第一面板 -->
			<view class="list">
				<view class="list-body">
					<view class="list-item">
						<text>14</text>
						<text>收藏的店铺</text>
					</view>
					<view class="list-item">
						<text>8</text>
						<text>收藏的商品</text>
					</view>
					<view class="list-item">
						<text>14</text>
						<text>关注的商品</text>
					</view>
					<view class="list-item">
						<text>14</text>
						<text>足迹</text>
					</view>
				</view>
			</view>
			<!-- 第二面板 -->
			<view class="list">
				<view class="title">
					我的订单
				</view>
				<view class="list-body">
					<view class="list-item">
						<image src="/static/my-icons/icon1.png"></image>
						<view>待付款</view>
					</view>
					<view class="list-item">
						<image src="/static/my-icons/icon2.png"></image>
						<view>待收获</view>
					</view>
					<view class="list-item">
						<image src="/static/my-icons/icon3.png"></image>
						<view>退款/退货</view>
					</view>
					<view class="list-item">
						<image src="/static/my-icons/icon4.png"></image>
						<view>全部订单</view>
					</view>
				</view>
			</view>
			<!-- 第三面板 -->
			<view class="list">
				<view class="third-list-item">
					<text>收获地址</text>
					<uni-icons type="arrowright" size="15"></uni-icons>
				</view>
				<view class="third-list-item">
					<text>联系客服</text>
					<uni-icons type="arrowright" size="15"></uni-icons>
				</view>
				<view class="third-list-item" @click="logout()">
					<text>退出登录</text>
					<uni-icons type="arrowright" size="15"></uni-icons>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import{mapState,mapMutations} from 'vuex'
	export default {
		data() {
			return {
				
			};
		},
		computed:{
			...mapState('m_user',['userinfo'])
		},
		methods:{
			...mapMutations('m_user',['updateAddress','updateUserInfo','updateToken']),
			async logout(){
				const succ = await uni.showModal({
					title:"提示",
					content:"确定退出登录吗？",
				})
				
				if(succ && succ.confirm){
					this.updateAddress({})
					this.updateUserInfo({})
					this.updateToken("clear")
				}
			}
		}
	}
</script>

<style lang="scss">
.my-userinfo{
	height: 100%;
	background-color: #F4F4F4;
	.top-box{
		height: 400rpx;
		background-color: #C00000;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		image{
			height: 90px;
			width: 90px;
			border-radius: 45px;
			border: 2px solid white;
			box-shadow: 0 1px 5px black;
		}
		.name{
			font-size: 16px;
			color: white;
			font-weight: bold;
			margin-top: 10px;
		}
	}
}
.pancel-list{
	padding: 0 10px;
	position: relative;
	top: -20px;
	
	.list{
		.title{
			line-height: 45px;
			padding-left: 10px;
			font-size: 15px;
			border-bottom: 1px solid #F4F4F4;
		}
		background-color: white;
		border-radius: 3px;
		margin: 8px;
		.list-body{
			display: flex;
			justify-content: space-around;
			.list-item{
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: space-around;
				padding: 10px 0;
				font-size: 15px;
				image{
					width: 35px;
					height: 35px;
				}
			}
		}
		.third-list-item{
			display: flex;
			justify-content: space-between;
			align-items: center;
			font-size: 15px;
			padding: 0 10px;
			line-height: 45px;
		}
	}
}

</style>
